﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SCS.Common.Models;

namespace SCS.DAL
{
    public class TeachingAssignmentRepository : Repository<TeachingAssignment>, ITeachingAssignmentRepository
    {
        public TeachingAssignmentRepository(SCSContext _context)
            : base(_context)
        { }

        /// <summary>
        /// Count all TeachingAssignment
        /// </summary>
        /// <returns></returns>
        public int GetCount()
        {
            return DBSet.Count();
        }

        /// <summary>
        /// Get TeachingAssignment
        /// </summary>
        /// <param name="pageNumber">Number of page</param>
        /// <param name="pageSize">Size of Page</param>
        /// <param name="classID">Id of class</param>
        /// <returns></returns>
        public IList<TeachingAssignment> GetTeachingAssignment(int pageNumber, int pageSize, int classID)
        {
            return DBSet.Where(s => s.classID == classID).OrderBy(x => x.subjectID)
         .Skip((pageNumber - 1) * pageSize)
         .Take(pageSize)
         .ToList();
        }
    }
}